﻿using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;

namespace FBGraph.ClientGenerator
{
    public class ObjectData
    {
        public String Name { get; set; }
        public String Description { get; set; }
        public String[] Remarks { get; set; }
        public String ExampleUrl { get; set; }
        public String ExampleUrlText { get; set; }
        public String ExampleDescription { get; set; }
        public String ExampleDescriptionUrl { get; set; }
        public String DetailUrl { get; set; }
        public List<PropertyData> Properties { get; set; }
        public List<ConnectionData> Connections { get; set; }

        public override String ToString()
        {
            return String.Format("{0}: {1}", Name, Description);
        }

        public class PropertyData
        {
            public String Name { get; set; }
            public String Description { get; set; }
            public Type Type { get; set; }
            public ExampleData ExampleData { get; set; }

            public override String ToString()
            {
                return String.Format("{0}: {1}", Name, Description);
            }
        }

        public class ConnectionData
        {
            public ConnectionData()
            {
                this.ExampleDetailData = new List<ExampleData>();
            }

            public String Name { get; set; }
            public String ExampleUrl { get; set; }
            public String Description { get; set; }
            public Type ItemType { get; set; }
            public Boolean IsPaged { get; set; }
            public ExampleData ExampleData { get; set; }

            public override String ToString()
            {
                return String.Format("{0}: {1}", Name, Description);
            }

            public List<ExampleData> ExampleDetailData { get; set; }
        }
    }

    public struct ExampleData
    {
        public ExampleData(JToken data, Uri sourceUri)
            : this()
        {
            this.Data = data;
            this.SourceUri = sourceUri;
        }

        public JToken Data { get; set; }
        public Uri SourceUri { get; set; }
    }
}
